home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / ccs_util.jar / com / commerceone / util / queue / ShiftRegister.class (.txt) < prev   
Encoding:
Java Class File  |  1999-12-09  |  1.3 KB  |  32 lines

  1. package com.commerceone.util.queue;
  2.  
  3. public class ShiftRegister extends Queue {
  4.    public ShiftRegister(int size) {
  5.       super(size);
  6.    }
  7.  
  8.    // $FF: renamed from: dq () java.lang.Object
  9.    public synchronized Object method_0() throws QueueEmptyException {
  10.       Object tmp = null;
  11.       if (((Queue)this).isEmpty()) {
  12.          throw new QueueEmptyException("Queue is empty");
  13.       } else {
  14.          tmp = super.vec.elementAt(super.frontIndex);
  15.          super.vec.setElementAt((Object)null, super.frontIndex);
  16.          super.frontIndex = (super.frontIndex + 1) % super.queueLen;
  17.          return tmp;
  18.       }
  19.    }
  20.  
  21.    // $FF: renamed from: q (java.lang.Object) void
  22.    public synchronized void method_1(Object entry) {
  23.       if (((Queue)this).size() == super.queueLen - 1 && super.frontIndex != super.nextAvail) {
  24.          super.vec.setElementAt((Object)null, super.frontIndex);
  25.          super.frontIndex = (super.frontIndex + 1) % super.queueLen;
  26.       }
  27.  
  28.       super.vec.setElementAt(entry, super.nextAvail);
  29.       super.nextAvail = (super.nextAvail + 1) % super.queueLen;
  30.    }
  31. }
  32.